using System;
using System.Collections.Generic;
using System.Text;
using DslEditorPowerToy.Languages;
using DslEditorPowerToy.Controls;

namespace EastBancTech.InstallerDefinition.DslEditorPowerToy.Controls
{
    internal partial class InstallerDefinitionDslEditorToolWindow
    {
        protected override void OnEnvironmentSelectionChanged(ISelectionProvider selectionProvider, SelectionChangeSource source)
        {
            base.OnEnvironmentSelectionChanged(selectionProvider, source);

            //Ensure diagram selection change
            if (SelectionChangeSource.Diagram == source)
            {
                //Get the represented model element
                if ((ModelHelper.GetRepresentedElement(selectionProvider.PrimarySelection) as Component) != null)
                {
                    //Activates the appropriate editor
                    this.ActivateEditor(new Guid("f7e44a49-a207-4af5-b852-7f055980012e"));
                }
            }
        }

    }
}
